package com.teamc.team;

import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

public class demo03 {
    public static void main(String[] args) {
        deo02 hs = new deo02();
        Scanner scan = new Scanner(System.in);
        int arr[] = new int[100];
       /* System.out.println("排序前："+ Arrays.toString(arr));
        hs.sort(arr);
        System.out.println("排序后："+Arrays.toString(arr))*/;
        int[] kaihu = null;
        int k;
        do {
            System.out.println("\n\n\n");
            System.out.println("\n     1. 随机生成账户" );
            System.out.println("\n     2.返回账户数据，从高到低：");
            System.out.println("\n     3. 删除第i个元素，返回其值");
            System.out.println("\n     4. 查找值为 e 的元素");
            System.out.println("\n     6. 结束程序运行");
            System.out.println("\n======================================");
            System.out.println("\n    请输入您的选择（1，2，3，4，6）");

            k = scan.nextInt();
            switch(k) { case 1:
                System.out.println("请输入你想要随机生成的账户个数：");
                int num = scan.nextInt();
                kaihu = kaihu(arr, num);
                break;
                case 2:
                    hs.sort(kaihu);
                    for (int j : kaihu)
                        System.out.print(j+ "  \n");
                    System.out.println("进来了");
                    break;
            }
        } while(k!=3);
        System.out.println("\n    再见！");
        System.out.println("排序前："+Arrays.toString(arr));
        hs.sort(arr);
        System.out.println("排序后："+Arrays.toString(arr));
    }

    public static int[] kaihu(int[] a ,int n) {
        Random rand = new Random();
        int[] ints = new int[n];
        System.out.println("正在随机生成账户中........");
        try {
            Thread.sleep(3000);
            int i=0,i1 = 0;
            while( i<n) {
                a[i] =rand.nextInt(7000);
                System.out.printf("账户user[%d]的余额为:%d\n",i++,a[i]);
                ints[i1++] = a[i];
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return ints;
    }
}
